home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!tsys.demon.co.uk
- From: Tom Wheeley <tomw@tsys.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Q: free() function
- Date: Mon, 08 Apr 96 06:50:36 GMT
- Organization: City Zen FM
- Message-ID: <828946236snz@tsys.demon.co.uk>
- References: <4k9ai7$rck@tibalt.supernet.ab.ca>
- Reply-To: tomw@tsys.demon.co.uk
- X-NNTP-Posting-Host: tsys.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.30
- X-Sig-By: Tomsystems Quote v1.2. (c)1996 Tom Wheeley, tomw@tsys.demon.co.uk
- X-Mail2News-Path: tsys.demon.co.uk
-
- In article <4k9ai7$rck@tibalt.supernet.ab.ca>
- lts@news.supernet.ab.ca "Len Starrenburg" writes:
-
- > When dynamically allocating memory for a series of strings and storing
- > the addresses in a char pointer array, can all the allocated memory be
- > freed simply using "free(array)" or does "free(array[x])" have to be
- > executed for each pointer in the array.
- >
- > I think the latter would be correct but I'm not 100% sure, please comment.
-
- Tou will need the latter followed by the former. The latter will remove
- each string, whereas the former will remove the array of pointers.
-
- Just doing the former will leave you with x strings floating in memory at some
- inaccessible location.
-
- .splitbung
- --
- * TQ 1.0 * The 'Just So Quotes'.
- I don't want to achieve immortality through my work. I want to achieve
- immortality through not dying."
- -- Woody Allen
-